<layout name="popup" />
<block name="content">
	<input type="hidden" name="ajax" id="ajax" value="1">
	<div class="popup-header">
		<h1>播放视频</h1>
		<i class="mid"></i>
		<a class="btn btn-normal hidden" onclick="save();">确定</a>
		<a class="btn btn-return" onclick="close_popup();">关闭</a>
	</div>
	<div class="popup-body">
		<div class="popup-body-scroll">
			<div class="popup-content">
				<a class="btn btn-normal" id="playId"/><i class="fa fa-play" aria-hidden="true"> 播放</i></a>
				<a class="btn btn-normal" id="stopId"/><i class="fa fa-stop" aria-hidden="true"> 停止</i></a>
			</div>
		</div>
	</div>
</block>
<block name="js">
	<script src="layui/ext/audio/voice-2.0.js"></script>
	<script type="text/javascript">
		RongIMLib.RongIMVoice.init();
		document.getElementById("playId").onclick = function() {
			RongIMLib.RongIMVoice.play("{$base64}");
		};
		document.getElementById("stopId").onclick = function() {
			RongIMLib.RongIMVoice.stop();
		};

		var index = parent.layer.getFrameIndex(window.name);
		layui.use(['global'], function() {
			var fn = {
				save : function() {
					send_form('form_data', '{:url("save")}', '', function(ret) {
						if (ret.status == 1) {
							parent.layer.msg(ret.info, {
								time : 1200
							}, function() {
								parent.layer.close(index);
								parent.location.reload(true);
							});
						} else {
							parent.layer.msg(ret.info);
							return false;
						};
					});
				},
				close_popup : function() {
					parent.layer.close(index);
				},
				play : function() {

				}
			};
			win_exp(fn);
		});
	</script>
</block>